package com.dingwen.treasure.kettle.enums;

import com.dingwen.treasure.kettle.base.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.EnumUtils;


/**
 * 消息枚举 <br>
 * <ol>
 *     <li>尽量保持枚举构造器和{@link RequestParamEnum#code}保持一致，方便调用</li>
 *     <li>此处{@link EnumUtils} 来自commons-lang3,由hystrix引入</li>
 * </ol>
 * <p>example</p>
 * <pre>
 *  {@code
 *   public static void main(String[] args) {
 *     // lang3 枚举工具类
 *     // 注意此处传递的参数是枚举构造器名称，不建议写魔法值
 *     RequestParamEnum body = EnumUtils.getEnum(RequestParamEnum.class, RequestParamEnum.BODY.code);
 *     System.out.println("body.getCode() = " + body.getCode());
 *     System.out.println("body.getValue() = " + body.getValue());
 *   }
 *  }
 * </pre>
 * <p>maven依赖</p>
 *  <pre>
 *      <dependency>
 *          <groupId>org.apache.commons</groupId>
 *          <artifactId>commons-lang3</artifactId>
 *          <version>3.1</version>
 *          <scope>runtime</scope>
 *     </dependency>
 *  </pre>
 *
 * @author dingwen
 * @date 2021/08/27
 */
@Getter
@AllArgsConstructor
public enum RequestParamEnum implements BaseEnum<String> {

    /**
     * 表单
     */
    FORM("FORM", "表单"),

    /**
     * 请求体
     */
    BODY("BODY", "请求体"),

    /**
     * 请求头
     */
    HEADER("HEADER", "请求头");


    /**
     * 请求参数类型
     */
    private final String code;


    /**
     * 请求参数描述
     */
    private final String description;

    /**
     * 获取枚举类描述
     *
     * @return {@link String}
     */
    @Override
    public String getEnumDescription() {
        return "请求参数类型";
    }
}


